#include <stdio.h>
#include <stdint.h>
#include "firmware.h"
#include "simple_uart.h"



#define devname "/dev/ttyS5"


void msg_handle(uint8_t *buf, uint32_t len) {
    msg_firmware_handle(buf, len);
  

}

uint8_t rbuf[3000];
int main(void) {
    int32_t rlen = 0;
    simple_uart_init(devname, 115200);
    while(1) {
        rlen = simple_uart_rec(rbuf, 2080);
        if(rlen > 0) {
            printf("rec %d\n", rlen);
            if(rlen == 2080) {
                msg_handle(rbuf, (uint32_t)rlen);
            }
        }
        usleep(10*1000);
    }


}




